FROM maven:3.9-eclipse-temurin-17 AS build
WORKDIR /build
COPY pom.xml .
COPY mp-common/pom.xml mp-common/pom.xml
COPY mp-verify/pom.xml mp-verify/pom.xml
COPY mp-gateway/pom.xml mp-gateway/pom.xml
COPY mp-chat/pom.xml mp-chat/pom.xml
COPY mp-common ./mp-common
COPY mp-verify ./mp-verify
COPY mp-gateway ./mp-gateway
COPY mp-chat ./mp-chat
RUN mvn -q -DskipTests -pl mp-verify -am package

FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=build /build/mp-verify/target/mp-verify-1.0-SNAPSHOT.jar app.jar
EXPOSE 9001
ENTRYPOINT ["java","-jar","/app/app.jar"]